package com.itheima.test;

import java.util.Scanner;

public class Test7 {
    public static void main(String[] args) {
        //需求：把整数的每一位添加到数组中
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一位大于0的整数：");
        int number = sc.nextInt();
        int copynumber = number;
        int count = 0;
        //得到整数的位数
        while (copynumber != 0){
            count++;
            copynumber /= 10;
        }
        int[] arr = new int[count];
        //把整数里面的每一位数放到数组中
        for (int i = arr.length - 1; i >= 0; i--) {
            arr[i] = number % 10;
            number /= 10;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
